<div class="row">
    <div class="col-md-12" style="margin-bottom: 20px;">
        <a href="{:addons_url('Donate://Donate/import')}" class="btn btn-sm btn-primary">导入捐赠明细</a>
    </div>
            <form action="">
                <div class="input-group search-form pull-right">
                    <div class="col-md-3 col-sm-4 col-xs-6">
                        <div class="form-group">
                            <div class="input-group">
                                <div class="input-group-addon">
                                    <i class="fa fa-calendar"></i>
                                </div>
                                <input type="text" name='donate_date_range' class="form-control pull-right input-sm" id="detail_date_range" placeholder="选择日期范围" value='{:I("donate_date_range")}'>
                            </div>
                        </div>
                        </div>
                        <div class="col-md-2 col-sm-4 col-xs-6">
                    <div class="form-group">
                        <select class="form-control input-sm" name='channel_id'>
                            <option value=''>选择捐赠渠道</option>
                            <volist name="channel_list" id='channel'>
                                <option value='{$key}' <eq name='Think.get.channel_id' value='$key'>selected='selected'</eq>>{$channel}</option>
                            </volist>
                        </select>
                    </div>
                    </div>
                    <div class="col-md-2 col-sm-4 col-xs-6">
                     <div class="form-group">
                        <input type="text" class="form-control input-sm" name="ref_name" placeholder="搜索用途" value='{:I("ref_name")}'>
                    </div>
                    </div>
                        <div class="col-md-3 col-sm-3 col-xs-6">
                        <div class="form-group">
                            <input type="text" class="form-control input-sm" name="donator" placeholder="搜索捐赠人名称" value='{:I("donator")}'>
                        </div>
                        </div>
                    <div class="col-md-2 col-sm-3 col-xs-6">
                        <button class="btn btn-sm btn-default btn-flat"><i class="fa fa-search"></i></button>
                        <a id="reset-search" class="btn btn-sm btn-default btn-flat" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="重置搜索"><i class="fa fa-refresh"></i></a>
                    </div>
                </div>
            </form>
    </div>
    <div class="box box-solid">
        <div class="box-body no-padding">
            <div class="nav-tabs-custom">
                <div class="tab-content no-padding mt-10">
                    <div class="table-responsive">
                        <table class="table table-hover">
                            <thead>
                                <tr>
                                    <th>捐赠日期</th>
                                    <th>捐赠人</th>
                                    <th>捐赠金额</th>
                                    <th>用途</th>
                                    <th>捐赠渠道</th>
                                    <th>备注</th>
                                    <th>线下捐赠</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody>
                            <volist name="donation_list" id="donation">
                                <tr>
                                    <td>{$donation.donate_date|date="Y-m-d",###}</td>
                                    <eq name='donation.name' value=''>
                                                    <td>无留名人士</td>
                                                <else />
                                                    <td>{$donation.name}</td>
                                                </eq>
                                    <td>￥{$donation.amount}</td>
                                    <td>{$donation.ref_title}</td>
                                    <td>{$donation.channel_name}</td>
                                    <td>{$donation.remark}</td>
                                                <td><eq name='donation.offline' value='1'>是<else/>否</eq></td>
                                <td nowrap>
                                <eq name='donation.offline' value='1'><a class='btn btn-danger btn-xs' data-toggle="modal" data-target="#deleteModal" data-delid="{$donation.id}">删除</a></eq>
                                </td>
                                </tr>
                            </volist>
                            </tbody>
                        </table>
                    </div>
                </div><!-- /.tab-content -->
            </div>
        </div><!-- /.box-body -->
    </div><!-- /.box -->
    <div class="row">
        <div class="col-md-7">
            <div class="pull-right">
                <include file="../app/Admin/View/default/common/pagination.html" />
            </div>
        </div>
    </div>
    
    <!-- 单独删除对话框 -->
<div class="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-hidden="true">
    <div class="modal-dialog modal-sm">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">删除捐赠信息</h4>
            </div>
            <div class="modal-body">
                <p><h5>数据删除后无法恢复，确定要删除吗？！</h5></p>
            </div>
            <div class="modal-footer">
                <input type="hidden" class="delid" value="">
                <button id='delete_btn' class="btn btn-danger">确认删除</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            </div>
        </div>
    </div>
</div>
    
    <link href="__PUBLIC__/libs/select2/select2.min.css" rel="stylesheet" type="text/css" />
    <link href="__PUBLIC__/libs/select2/select2.min.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="__PUBLIC__/libs/daterangepicker/daterangepicker-bs3.css">
<script type="text/javascript" src="__PUBLIC__/libs/daterangepicker/daterangepicker.js"></script>
<script type="text/javascript" src="__PUBLIC__/libs/daterangepicker/lang/zh-cn.js"></script>
<script type="text/javascript" src="__PUBLIC__/libs/select2/select2.full.js"></script>
<script type="text/javascript" src="__PUBLIC__/libs/select2/zh-CN.js"></script>
<script type="text/javascript" src="__PUBLIC__/libs/bootstrap-validator/validator.js"></script>
<script type="text/javascript" src="__PUBLIC__/libs/bootstrap-validator/bootstrap-validator.js"></script>
<script type="text/javascript" src="__PUBLIC__/libs/jquery.group-of-checkbox/jquery.group-of-checkbox.js"></script>
<script type="text/javascript" src="__PUBLIC__/libs/bootstrap-messagebox/bootstrap-messagebox.js"></script>
<script type="text/javascript">
    
jQuery(document).ready(function ($) {
   $('#deleteModal').on('show.bs.modal', function (event) {
      var aButton = $(event.relatedTarget);
      var recipient = aButton.data('delid');
      var modal = $(this);
      modal.find('input.delid').val(recipient);
    });

    $('#delete_btn').on('click', function() {
        var id = $(this).prev('input.delid').val();
        $('#deleteModal').modal('hide');
        ajaxlink($(this), "/admin/addons/execute/_addons/Donate/_controller/Donate/_action/delete/id/" + id);
    });
    
    $('#detail_date_range').daterangepicker({
        format: 'YYYY/MM/DD',
        applyClass : 'btn btn-primary btn-flat btn-sm',
        cancelClass : 'btn btn-primary btn-flat btn-sm',
        clearBtn: true,
        locale: {
            applyLabel: '应用',
            cancelLabel: '取消',
            fromLabel: '从',
            toLabel: '到',
            weekLabel: '周',
            customRangeLabel: '自定义范围',
            daysOfWeek: moment()._lang._weekdaysMin.slice(),
            monthNames: moment()._lang._monthsShort.slice(),
            firstDay: 0
        }
    });

});
    
</script>